/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('rdc', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddEnterpriseMemberRequest {
  instanceId?: string(name='InstanceId'),
  operator?: string(name='Operator'),
  staffId?: string(name='StaffId'),
}

model AddEnterpriseMemberResponseBody = {
  code?: int32(name='Code'),
  data?: boolean(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddEnterpriseMemberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddEnterpriseMemberResponseBody(name='body'),
}

async function addEnterpriseMemberWithOptions(request: AddEnterpriseMemberRequest, runtime: Util.RuntimeOptions): AddEnterpriseMemberResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operator)) {
    query['Operator'] = request.operator;
  }
  if (!Util.isUnset(request.staffId)) {
    query['StaffId'] = request.staffId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddEnterpriseMember',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addEnterpriseMember(request: AddEnterpriseMemberRequest): AddEnterpriseMemberResponse {
  var runtime = new Util.RuntimeOptions{};
  return addEnterpriseMemberWithOptions(request, runtime);
}

model AddRamMemberRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
  staffIdentifier?: string(name='StaffIdentifier'),
}

model AddRamMemberResponseBody = {
  code?: int32(name='Code'),
  data?: [ string ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddRamMemberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddRamMemberResponseBody(name='body'),
}

async function addRamMemberWithOptions(request: AddRamMemberRequest, runtime: Util.RuntimeOptions): AddRamMemberResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    body['CorpIdentifier'] = request.corpIdentifier;
  }
  if (!Util.isUnset(request.staffIdentifier)) {
    body['StaffIdentifier'] = request.staffIdentifier;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddRamMember',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addRamMember(request: AddRamMemberRequest): AddRamMemberResponse {
  var runtime = new Util.RuntimeOptions{};
  return addRamMemberWithOptions(request, runtime);
}

model ApproveJoinCompanyRequest {
  applicationIds?: string(name='ApplicationIds'),
  corpIdentifier?: string(name='CorpIdentifier'),
}

model ApproveJoinCompanyResponseBody = {
  code?: int32(name='Code'),
  data?: [ string ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ApproveJoinCompanyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ApproveJoinCompanyResponseBody(name='body'),
}

async function approveJoinCompanyWithOptions(request: ApproveJoinCompanyRequest, runtime: Util.RuntimeOptions): ApproveJoinCompanyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationIds)) {
    body['ApplicationIds'] = request.applicationIds;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ApproveJoinCompany',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function approveJoinCompany(request: ApproveJoinCompanyRequest): ApproveJoinCompanyResponse {
  var runtime = new Util.RuntimeOptions{};
  return approveJoinCompanyWithOptions(request, runtime);
}

model CreateEnterpriseRequest {
  creatorStaffId?: string(name='CreatorStaffId'),
  description?: string(name='Description'),
  domain?: string(name='Domain'),
  emails?: map[string]any(name='Emails'),
  name?: string(name='Name'),
}

model CreateEnterpriseShrinkRequest {
  creatorStaffId?: string(name='CreatorStaffId'),
  description?: string(name='Description'),
  domain?: string(name='Domain'),
  emailsShrink?: string(name='Emails'),
  name?: string(name='Name'),
}

model CreateEnterpriseResponseBody = {
  code?: int32(name='Code'),
  data?: {
    id?: long(name='Id'),
    identifier?: string(name='Identifier'),
    name?: string(name='Name'),
    prohibitCode?: int32(name='ProhibitCode'),
    status?: int32(name='Status'),
    type?: int32(name='Type'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateEnterpriseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateEnterpriseResponseBody(name='body'),
}

async function createEnterpriseWithOptions(tmpReq: CreateEnterpriseRequest, runtime: Util.RuntimeOptions): CreateEnterpriseResponse {
  Util.validateModel(tmpReq);
  var request = new CreateEnterpriseShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.emails)) {
    request.emailsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.emails, 'Emails', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.creatorStaffId)) {
    query['CreatorStaffId'] = request.creatorStaffId;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.emailsShrink)) {
    query['Emails'] = request.emailsShrink;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateEnterprise',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createEnterprise(request: CreateEnterpriseRequest): CreateEnterpriseResponse {
  var runtime = new Util.RuntimeOptions{};
  return createEnterpriseWithOptions(request, runtime);
}

model CreateWorkitemRequest {
  AKProjectId?: int32(name='AKProjectId'),
  assignedTo?: string(name='AssignedTo'),
  author?: string(name='Author'),
  cfList?: string(name='CfList'),
  corpIdentifier?: string(name='CorpIdentifier'),
  description?: string(name='Description'),
  moduleIds?: string(name='ModuleIds'),
  priorityId?: int32(name='PriorityId'),
  seriousLevelId?: int32(name='SeriousLevelId'),
  stamp?: string(name='Stamp'),
  subject?: string(name='Subject'),
  templateId?: int32(name='TemplateId'),
  verifier?: string(name='Verifier'),
  watcherUsers?: string(name='WatcherUsers'),
}

model CreateWorkitemResponseBody = {
  code?: int32(name='Code'),
  data?: int32(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateWorkitemResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateWorkitemResponseBody(name='body'),
}

async function createWorkitemWithOptions(request: CreateWorkitemRequest, runtime: Util.RuntimeOptions): CreateWorkitemResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.AKProjectId)) {
    body['AKProjectId'] = request.AKProjectId;
  }
  if (!Util.isUnset(request.assignedTo)) {
    body['AssignedTo'] = request.assignedTo;
  }
  if (!Util.isUnset(request.author)) {
    body['Author'] = request.author;
  }
  if (!Util.isUnset(request.cfList)) {
    body['CfList'] = request.cfList;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.moduleIds)) {
    body['ModuleIds'] = request.moduleIds;
  }
  if (!Util.isUnset(request.priorityId)) {
    body['PriorityId'] = request.priorityId;
  }
  if (!Util.isUnset(request.seriousLevelId)) {
    body['SeriousLevelId'] = request.seriousLevelId;
  }
  if (!Util.isUnset(request.stamp)) {
    body['Stamp'] = request.stamp;
  }
  if (!Util.isUnset(request.subject)) {
    body['Subject'] = request.subject;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.verifier)) {
    body['Verifier'] = request.verifier;
  }
  if (!Util.isUnset(request.watcherUsers)) {
    body['WatcherUsers'] = request.watcherUsers;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateWorkitem',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createWorkitem(request: CreateWorkitemRequest): CreateWorkitemResponse {
  var runtime = new Util.RuntimeOptions{};
  return createWorkitemWithOptions(request, runtime);
}

model GetBindedUserByDingIdRequest {
  dingId?: string(name='DingId'),
}

model GetBindedUserByDingIdResponseBody = {
  code?: int32(name='Code'),
  data?: {
    aliyunUser?: {
      accountStructure?: int32(name='AccountStructure'),
      aliyunId?: string(name='AliyunId'),
      email?: string(name='Email'),
      havanaId?: string(name='HavanaId'),
      id?: int32(name='Id'),
      kp?: string(name='Kp'),
      nickName?: string(name='NickName'),
      realname?: string(name='Realname'),
      taobaoNick?: string(name='TaobaoNick'),
    }(name='AliyunUser'),
    dingtalkUser?: {
      codeUserName?: string(name='CodeUserName'),
      dingId?: string(name='DingId'),
      dingtalkUserId?: int32(name='DingtalkUserId'),
      id?: int32(name='Id'),
      nick?: string(name='Nick'),
      unionId?: string(name='UnionId'),
    }(name='DingtalkUser'),
    guid?: string(name='Guid'),
    id?: int32(name='Id'),
    isValid?: boolean(name='IsValid'),
    mainAccountType?: string(name='MainAccountType'),
    nickName?: string(name='NickName'),
    userProfileDTO?: {
      avatar?: string(name='Avatar'),
      createdAt?: long(name='CreatedAt'),
      dataSource?: string(name='DataSource'),
      email?: string(name='Email'),
      englishName?: string(name='EnglishName'),
      mobile?: string(name='Mobile'),
      name?: string(name='Name'),
      nickName?: string(name='NickName'),
      userId?: int32(name='UserId'),
    }(name='UserProfileDTO'),
    uuid?: string(name='Uuid'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetBindedUserByDingIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetBindedUserByDingIdResponseBody(name='body'),
}

async function getBindedUserByDingIdWithOptions(request: GetBindedUserByDingIdRequest, runtime: Util.RuntimeOptions): GetBindedUserByDingIdResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetBindedUserByDingId',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getBindedUserByDingId(request: GetBindedUserByDingIdRequest): GetBindedUserByDingIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getBindedUserByDingIdWithOptions(request, runtime);
}

model GetChangeLogRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
  targetIds?: map[string]any(name='TargetIds'),
  targetType?: string(name='TargetType'),
}

model GetChangeLogShrinkRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
  targetIdsShrink?: string(name='TargetIds'),
  targetType?: string(name='TargetType'),
}

model GetChangeLogResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      newValue?: string(name='NewValue'),
      oldValue?: string(name='OldValue'),
      other?: string(name='Other'),
      propertyKey?: string(name='PropertyKey'),
      propertyType?: string(name='PropertyType'),
      targetId?: int32(name='TargetId'),
      targetType?: string(name='TargetType'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetChangeLogResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetChangeLogResponseBody(name='body'),
}

async function getChangeLogWithOptions(tmpReq: GetChangeLogRequest, runtime: Util.RuntimeOptions): GetChangeLogResponse {
  Util.validateModel(tmpReq);
  var request = new GetChangeLogShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.targetIds)) {
    request.targetIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.targetIds, 'TargetIds', 'json');
  }
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetChangeLog',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getChangeLog(request: GetChangeLogRequest): GetChangeLogResponse {
  var runtime = new Util.RuntimeOptions{};
  return getChangeLogWithOptions(request, runtime);
}

model GetCustomFieldsByTemplateIdRequest {
  AKProjectId?: int32(name='AKProjectId'),
  corpIdentifier?: string(name='CorpIdentifier'),
  templateId?: int32(name='TemplateId'),
}

model GetCustomFieldsByTemplateIdResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      createdAt?: long(name='CreatedAt'),
      defaultValue?: string(name='DefaultValue'),
      description?: string(name='Description'),
      dynamic?: boolean(name='Dynamic'),
      editable?: boolean(name='Editable'),
      fieldFormat?: string(name='FieldFormat'),
      id?: int32(name='Id'),
      isDelete?: boolean(name='IsDelete'),
      isRemember?: boolean(name='IsRemember'),
      isRequired?: boolean(name='IsRequired'),
      maxLength?: int32(name='MaxLength'),
      minLength?: int32(name='MinLength'),
      name?: string(name='Name'),
      nameI18N?: string(name='NameI18N'),
      other?: string(name='Other'),
      possibleValues?: string(name='PossibleValues'),
      type?: string(name='Type'),
      updatedAt?: long(name='UpdatedAt'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetCustomFieldsByTemplateIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetCustomFieldsByTemplateIdResponseBody(name='body'),
}

async function getCustomFieldsByTemplateIdWithOptions(request: GetCustomFieldsByTemplateIdRequest, runtime: Util.RuntimeOptions): GetCustomFieldsByTemplateIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.AKProjectId)) {
    body['AKProjectId'] = request.AKProjectId;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetCustomFieldsByTemplateId',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCustomFieldsByTemplateId(request: GetCustomFieldsByTemplateIdRequest): GetCustomFieldsByTemplateIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCustomFieldsByTemplateIdWithOptions(request, runtime);
}

model GetIssueByIdRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
  id?: int32(name='Id'),
}

model GetIssueByIdResponseBody = {
  code?: int32(name='Code'),
  data?: {
    akProjectId?: int32(name='AkProjectId'),
    assignedTo?: string(name='AssignedTo'),
    assignedToId?: int32(name='AssignedToId'),
    assignedToIdList?: string(name='AssignedToIdList'),
    assignedToIds?: string(name='AssignedToIds'),
    assignedToMaps?: string(name='AssignedToMaps'),
    assignedToStaffId?: string(name='AssignedToStaffId'),
    attachmentIds?: string(name='AttachmentIds'),
    attachmentList?: string(name='AttachmentList'),
    attachmented?: boolean(name='Attachmented'),
    blackListNotice?: string(name='BlackListNotice'),
    cfsList?: [ 
      {
        id?: string(name='Id'),
        name?: string(name='Name'),
        type?: string(name='Type'),
        value?: string(name='Value'),
      }
    ](name='CfsList'),
    changeLogList?: string(name='ChangeLogList'),
    commentList?: string(name='CommentList'),
    commitDate?: long(name='CommitDate'),
    createdAt?: long(name='CreatedAt'),
    description?: string(name='Description'),
    guid?: string(name='Guid'),
    id?: int32(name='Id'),
    idPath?: string(name='IdPath'),
    ignoreCheck?: boolean(name='IgnoreCheck'),
    ignoreIntegrate?: boolean(name='IgnoreIntegrate'),
    issueTypeId?: int32(name='IssueTypeId'),
    logicalStatus?: string(name='LogicalStatus'),
    moduleIds?: string(name='ModuleIds'),
    moduleList?: string(name='ModuleList'),
    moduleUpdated?: boolean(name='ModuleUpdated'),
    parentId?: int32(name='ParentId'),
    priority?: string(name='Priority'),
    priorityId?: int32(name='PriorityId'),
    projectIds?: string(name='ProjectIds'),
    recordChangeLog?: boolean(name='RecordChangeLog'),
    regionId?: int32(name='RegionId'),
    relatedAKProjectGuids?: string(name='RelatedAKProjectGuids'),
    relatedAKProjectIds?: string(name='RelatedAKProjectIds'),
    relatedUserIds?: string(name='RelatedUserIds'),
    sendWangwang?: boolean(name='SendWangwang'),
    seriousLevel?: string(name='SeriousLevel'),
    seriousLevelId?: int32(name='SeriousLevelId'),
    skipCollab?: boolean(name='SkipCollab'),
    stamp?: string(name='Stamp'),
    status?: string(name='Status'),
    statusId?: int32(name='StatusId'),
    statusStage?: int32(name='StatusStage'),
    subject?: string(name='Subject'),
    tagIdList?: string(name='TagIdList'),
    templateId?: int32(name='TemplateId'),
    trackerIds?: string(name='TrackerIds'),
    trackers?: string(name='Trackers'),
    updateStatusAt?: long(name='UpdateStatusAt'),
    updatedAt?: long(name='UpdatedAt'),
    user?: string(name='User'),
    userId?: int32(name='UserId'),
    userStaffId?: string(name='UserStaffId'),
    verifier?: string(name='Verifier'),
    verifierId?: int32(name='VerifierId'),
    verifierStaffId?: string(name='VerifierStaffId'),
    versionIds?: string(name='VersionIds'),
    versionList?: string(name='VersionList'),
    watched?: boolean(name='Watched'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetIssueByIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetIssueByIdResponseBody(name='body'),
}

async function getIssueByIdWithOptions(request: GetIssueByIdRequest, runtime: Util.RuntimeOptions): GetIssueByIdResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetIssueById',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getIssueById(request: GetIssueByIdRequest): GetIssueByIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getIssueByIdWithOptions(request, runtime);
}

model GetJoinCodeRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
}

model GetJoinCodeResponseBody = {
  code?: int32(name='Code'),
  data?: {
    code?: string(name='Code'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetJoinCodeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetJoinCodeResponseBody(name='body'),
}

async function getJoinCodeWithOptions(request: GetJoinCodeRequest, runtime: Util.RuntimeOptions): GetJoinCodeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetJoinCode',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getJoinCode(request: GetJoinCodeRequest): GetJoinCodeResponse {
  var runtime = new Util.RuntimeOptions{};
  return getJoinCodeWithOptions(request, runtime);
}

model GetProjectMembersRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
  projectId?: int32(name='ProjectId'),
  staffId?: string(name='StaffId'),
}

model GetProjectMembersResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      id?: int32(name='Id'),
      identifier?: string(name='Identifier'),
      name?: string(name='Name'),
      users?: [ 
        {
          avatar?: string(name='Avatar'),
          email?: string(name='Email'),
          id?: int32(name='Id'),
          nickName?: string(name='NickName'),
          realName?: string(name='RealName'),
          staffId?: string(name='StaffId'),
        }
      ](name='Users'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetProjectMembersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetProjectMembersResponseBody(name='body'),
}

async function getProjectMembersWithOptions(request: GetProjectMembersRequest, runtime: Util.RuntimeOptions): GetProjectMembersResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetProjectMembers',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getProjectMembers(request: GetProjectMembersRequest): GetProjectMembersResponse {
  var runtime = new Util.RuntimeOptions{};
  return getProjectMembersWithOptions(request, runtime);
}

model GetUserByAliyunPkRequest {
  pk?: string(name='Pk'),
}

model GetUserByAliyunPkResponseBody = {
  code?: int32(name='Code'),
  data?: {
    aliyunUser?: {
      accountStructure?: int32(name='AccountStructure'),
      aliyunId?: string(name='AliyunId'),
      email?: string(name='Email'),
      havanaId?: string(name='HavanaId'),
      id?: int32(name='Id'),
      kp?: string(name='Kp'),
      nickName?: string(name='NickName'),
      realname?: string(name='Realname'),
      taobaoNick?: string(name='TaobaoNick'),
    }(name='AliyunUser'),
    dingtalkUser?: {
      codeUserName?: string(name='CodeUserName'),
      dingId?: string(name='DingId'),
      dingtalkUserId?: int32(name='DingtalkUserId'),
      id?: int32(name='Id'),
      nick?: string(name='Nick'),
      unionId?: string(name='UnionId'),
    }(name='DingtalkUser'),
    guid?: string(name='Guid'),
    id?: int32(name='Id'),
    isValid?: boolean(name='IsValid'),
    mainAccountType?: string(name='MainAccountType'),
    nickName?: string(name='NickName'),
    userProfileDTO?: {
      avatar?: string(name='Avatar'),
      createdAt?: long(name='CreatedAt'),
      dataSource?: string(name='DataSource'),
      email?: string(name='Email'),
      englishName?: string(name='EnglishName'),
      mobile?: string(name='Mobile'),
      name?: string(name='Name'),
      nickName?: string(name='NickName'),
      userId?: int32(name='UserId'),
    }(name='UserProfileDTO'),
    uuid?: string(name='Uuid'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetUserByAliyunPkResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUserByAliyunPkResponseBody(name='body'),
}

async function getUserByAliyunPkWithOptions(request: GetUserByAliyunPkRequest, runtime: Util.RuntimeOptions): GetUserByAliyunPkResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetUserByAliyunPk',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUserByAliyunPk(request: GetUserByAliyunPkRequest): GetUserByAliyunPkResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUserByAliyunPkWithOptions(request, runtime);
}

model GetWorkitemByIdRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
  id?: int32(name='Id'),
}

model GetWorkitemByIdResponseBody = {
  code?: int32(name='Code'),
  data?: {
    akProjectId?: int32(name='AkProjectId'),
    assignedTo?: string(name='AssignedTo'),
    assignedToId?: int32(name='AssignedToId'),
    assignedToIdList?: string(name='AssignedToIdList'),
    assignedToIds?: string(name='AssignedToIds'),
    assignedToMaps?: string(name='AssignedToMaps'),
    assignedToStaffId?: string(name='AssignedToStaffId'),
    attachmentIds?: string(name='AttachmentIds'),
    attachmentList?: string(name='AttachmentList'),
    attachmented?: boolean(name='Attachmented'),
    blackListNotice?: string(name='BlackListNotice'),
    cfsList?: [ 
      {
        id?: string(name='Id'),
        name?: string(name='Name'),
        type?: string(name='Type'),
        value?: string(name='Value'),
      }
    ](name='CfsList'),
    changeLogList?: string(name='ChangeLogList'),
    commentList?: string(name='CommentList'),
    commitDate?: long(name='CommitDate'),
    createdAt?: long(name='CreatedAt'),
    description?: string(name='Description'),
    guid?: string(name='Guid'),
    id?: int32(name='Id'),
    idPath?: string(name='IdPath'),
    ignoreCheck?: boolean(name='IgnoreCheck'),
    ignoreIntegrate?: boolean(name='IgnoreIntegrate'),
    issueTypeId?: int32(name='IssueTypeId'),
    logicalStatus?: string(name='LogicalStatus'),
    moduleIds?: string(name='ModuleIds'),
    moduleList?: string(name='ModuleList'),
    moduleUpdated?: boolean(name='ModuleUpdated'),
    parentId?: int32(name='ParentId'),
    priority?: string(name='Priority'),
    priorityId?: int32(name='PriorityId'),
    projectIds?: string(name='ProjectIds'),
    recordChangeLog?: boolean(name='RecordChangeLog'),
    regionId?: int32(name='RegionId'),
    relatedAKProjectGuids?: string(name='RelatedAKProjectGuids'),
    relatedAKProjectIds?: string(name='RelatedAKProjectIds'),
    relatedUserIds?: string(name='RelatedUserIds'),
    sendWangwang?: boolean(name='SendWangwang'),
    seriousLevel?: string(name='SeriousLevel'),
    seriousLevelId?: int32(name='SeriousLevelId'),
    skipCollab?: boolean(name='SkipCollab'),
    stamp?: string(name='Stamp'),
    status?: string(name='Status'),
    statusId?: int32(name='StatusId'),
    statusStage?: int32(name='StatusStage'),
    subject?: string(name='Subject'),
    tagIdList?: string(name='TagIdList'),
    templateId?: int32(name='TemplateId'),
    trackerIds?: string(name='TrackerIds'),
    trackers?: string(name='Trackers'),
    updateStatusAt?: long(name='UpdateStatusAt'),
    updatedAt?: long(name='UpdatedAt'),
    user?: string(name='User'),
    userId?: int32(name='UserId'),
    userStaffId?: string(name='UserStaffId'),
    verifier?: string(name='Verifier'),
    verifierId?: int32(name='VerifierId'),
    verifierStaffId?: string(name='VerifierStaffId'),
    versionIds?: string(name='VersionIds'),
    versionList?: string(name='VersionList'),
    watched?: boolean(name='Watched'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetWorkitemByIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetWorkitemByIdResponseBody(name='body'),
}

async function getWorkitemByIdWithOptions(request: GetWorkitemByIdRequest, runtime: Util.RuntimeOptions): GetWorkitemByIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetWorkitemById',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getWorkitemById(request: GetWorkitemByIdRequest): GetWorkitemByIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getWorkitemByIdWithOptions(request, runtime);
}

model JoinCompanyRequest {
  code?: string(name='Code'),
}

model JoinCompanyResponseBody = {
  code?: int32(name='Code'),
  data?: {
    applicationId?: string(name='ApplicationId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model JoinCompanyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: JoinCompanyResponseBody(name='body'),
}

async function joinCompanyWithOptions(request: JoinCompanyRequest, runtime: Util.RuntimeOptions): JoinCompanyResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.code)) {
    body['Code'] = request.code;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'JoinCompany',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function joinCompany(request: JoinCompanyRequest): JoinCompanyResponse {
  var runtime = new Util.RuntimeOptions{};
  return joinCompanyWithOptions(request, runtime);
}

model SearchProjectsByRegionRequest {
  corpIdentifier?: string(name='CorpIdentifier'),
  pageSize?: int32(name='PageSize'),
  region?: string(name='Region'),
  status?: string(name='Status'),
  toPage?: int32(name='ToPage'),
}

model SearchProjectsByRegionResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      aoneId?: int32(name='AoneId'),
      aoneType?: string(name='AoneType'),
      customFieldMap?: [ string ](name='CustomFieldMap'),
      description?: string(name='Description'),
      fullName?: string(name='FullName'),
      icons?: [ string ](name='Icons'),
      id?: int32(name='Id'),
      idPath?: string(name='IdPath'),
      mode?: string(name='Mode'),
      name?: string(name='Name'),
      parentId?: int32(name='ParentId'),
      stamp?: string(name='Stamp'),
      status?: string(name='Status'),
      type?: string(name='Type'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SearchProjectsByRegionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchProjectsByRegionResponseBody(name='body'),
}

async function searchProjectsByRegionWithOptions(request: SearchProjectsByRegionRequest, runtime: Util.RuntimeOptions): SearchProjectsByRegionResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchProjectsByRegion',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchProjectsByRegion(request: SearchProjectsByRegionRequest): SearchProjectsByRegionResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchProjectsByRegionWithOptions(request, runtime);
}

model SearchTestCaseRequest {
  akProjectId?: string(name='AkProjectId'),
  caseTag?: string(name='CaseTag'),
  corpIdentifier?: string(name='CorpIdentifier'),
  createDateEnd?: string(name='CreateDateEnd'),
  createDateStart?: string(name='CreateDateStart'),
  pageNum?: string(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  updateDateEnd?: string(name='UpdateDateEnd'),
  updateDateStart?: string(name='UpdateDateStart'),
}

model SearchTestCaseResponseBody = {
  code?: int32(name='Code'),
  data?: {
    cases?: string(name='Cases'),
    pageNum?: string(name='PageNum'),
    pageSize?: string(name='PageSize'),
    pageTotal?: string(name='PageTotal'),
    totalCount?: string(name='TotalCount'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SearchTestCaseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTestCaseResponseBody(name='body'),
}

async function searchTestCaseWithOptions(request: SearchTestCaseRequest, runtime: Util.RuntimeOptions): SearchTestCaseResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.akProjectId)) {
    body['AkProjectId'] = request.akProjectId;
  }
  if (!Util.isUnset(request.caseTag)) {
    body['CaseTag'] = request.caseTag;
  }
  if (!Util.isUnset(request.createDateEnd)) {
    body['CreateDateEnd'] = request.createDateEnd;
  }
  if (!Util.isUnset(request.createDateStart)) {
    body['CreateDateStart'] = request.createDateStart;
  }
  if (!Util.isUnset(request.pageNum)) {
    body['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.updateDateEnd)) {
    body['UpdateDateEnd'] = request.updateDateEnd;
  }
  if (!Util.isUnset(request.updateDateStart)) {
    body['UpdateDateStart'] = request.updateDateStart;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SearchTestCase',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTestCase(request: SearchTestCaseRequest): SearchTestCaseResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTestCaseWithOptions(request, runtime);
}

model SearchWorkitemRequest {
  AKProjectId?: int32(name='AKProjectId'),
  corpIdentifier?: string(name='CorpIdentifier'),
  createdAtEnd?: string(name='CreatedAtEnd'),
  createdAtStart?: string(name='CreatedAtStart'),
  pageSize?: int32(name='PageSize'),
  sprintId?: int32(name='SprintId'),
  stamp?: string(name='Stamp'),
  toPage?: int32(name='ToPage'),
}

model SearchWorkitemResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      akPaths?: string(name='AkPaths'),
      akProjectId?: int32(name='AkProjectId'),
      akVersionIds?: string(name='AkVersionIds'),
      assignedTo?: string(name='AssignedTo'),
      assignedToId?: int32(name='AssignedToId'),
      assignedToIdList?: string(name='AssignedToIdList'),
      assignedToIds?: string(name='AssignedToIds'),
      assignedToStaffId?: string(name='AssignedToStaffId'),
      attachmentIds?: string(name='AttachmentIds'),
      attachmentList?: string(name='AttachmentList'),
      attachmented?: boolean(name='Attachmented'),
      blackListNotice?: string(name='BlackListNotice'),
      changeLogList?: string(name='ChangeLogList'),
      closedDuration?: int32(name='ClosedDuration'),
      commentList?: string(name='CommentList'),
      commitDate?: long(name='CommitDate'),
      createdAt?: long(name='CreatedAt'),
      devDuration?: int32(name='DevDuration'),
      fixedDuration?: int32(name='FixedDuration'),
      fixedUserId?: int32(name='FixedUserId'),
      id?: int32(name='Id'),
      idPath?: string(name='IdPath'),
      ignoreCheck?: boolean(name='IgnoreCheck'),
      ignoreIntegrate?: boolean(name='IgnoreIntegrate'),
      issueRelations?: string(name='IssueRelations'),
      issueTypeId?: int32(name='IssueTypeId'),
      linePath?: string(name='LinePath'),
      logicalStatus?: string(name='LogicalStatus'),
      moduleIds?: string(name='ModuleIds'),
      moduleList?: string(name='ModuleList'),
      moduleUpdated?: boolean(name='ModuleUpdated'),
      parentId?: int32(name='ParentId'),
      priority?: string(name='Priority'),
      priorityId?: int32(name='PriorityId'),
      projectId?: int32(name='ProjectId'),
      projectIds?: string(name='ProjectIds'),
      recordChangeLog?: boolean(name='RecordChangeLog'),
      region?: string(name='Region'),
      relatedAKProjectGuids?: string(name='RelatedAKProjectGuids'),
      relatedAKProjectIds?: string(name='RelatedAKProjectIds'),
      relatedUserIds?: string(name='RelatedUserIds'),
      respondDuration?: int32(name='RespondDuration'),
      scope?: int32(name='Scope'),
      scopeUserIds?: string(name='ScopeUserIds'),
      sendWangwang?: boolean(name='SendWangwang'),
      seriousLevel?: string(name='SeriousLevel'),
      seriousLevelId?: int32(name='SeriousLevelId'),
      skipCollab?: boolean(name='SkipCollab'),
      solution?: int32(name='Solution'),
      source?: string(name='Source'),
      sourceId?: int32(name='SourceId'),
      sprintId?: int32(name='SprintId'),
      stamp?: string(name='Stamp'),
      status?: string(name='Status'),
      statusId?: int32(name='StatusId'),
      statusStage?: int32(name='StatusStage'),
      subject?: string(name='Subject'),
      tagIdList?: string(name='TagIdList'),
      templateId?: int32(name='TemplateId'),
      testsuiteId?: int32(name='TestsuiteId'),
      trackerIds?: string(name='TrackerIds'),
      trackers?: string(name='Trackers'),
      updatedAt?: long(name='UpdatedAt'),
      user?: string(name='User'),
      userId?: int32(name='UserId'),
      userStaffId?: string(name='UserStaffId'),
      verifier?: string(name='Verifier'),
      verifierId?: int32(name='VerifierId'),
      verifierStaffId?: string(name='VerifierStaffId'),
      versionId?: int32(name='VersionId'),
      versionIds?: string(name='VersionIds'),
      versionList?: string(name='VersionList'),
      watched?: boolean(name='Watched'),
      watcherIdList?: string(name='WatcherIdList'),
    }
  ](name='Data'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  toPage?: int32(name='ToPage'),
  totalCount?: int32(name='TotalCount'),
  totalPages?: int32(name='TotalPages'),
}

model SearchWorkitemResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchWorkitemResponseBody(name='body'),
}

async function searchWorkitemWithOptions(request: SearchWorkitemRequest, runtime: Util.RuntimeOptions): SearchWorkitemResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.AKProjectId)) {
    body['AKProjectId'] = request.AKProjectId;
  }
  if (!Util.isUnset(request.createdAtEnd)) {
    body['CreatedAtEnd'] = request.createdAtEnd;
  }
  if (!Util.isUnset(request.createdAtStart)) {
    body['CreatedAtStart'] = request.createdAtStart;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sprintId)) {
    body['SprintId'] = request.sprintId;
  }
  if (!Util.isUnset(request.stamp)) {
    body['Stamp'] = request.stamp;
  }
  if (!Util.isUnset(request.toPage)) {
    body['ToPage'] = request.toPage;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SearchWorkitem',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchWorkitem(request: SearchWorkitemRequest): SearchWorkitemResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchWorkitemWithOptions(request, runtime);
}

model SearchWorkitemWithTotalCountRequest {
  AKProjectId?: int32(name='AKProjectId'),
  corpIdentifier?: string(name='CorpIdentifier'),
  pageSize?: int32(name='PageSize'),
  sprintId?: int32(name='SprintId'),
  stamp?: string(name='Stamp'),
  toPage?: int32(name='ToPage'),
}

model SearchWorkitemWithTotalCountResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      akPaths?: string(name='AkPaths'),
      akProjectId?: int32(name='AkProjectId'),
      akVersionIds?: string(name='AkVersionIds'),
      assignedTo?: string(name='AssignedTo'),
      assignedToId?: int32(name='AssignedToId'),
      assignedToIdList?: string(name='AssignedToIdList'),
      assignedToIds?: string(name='AssignedToIds'),
      assignedToStaffId?: string(name='AssignedToStaffId'),
      attachmentIds?: string(name='AttachmentIds'),
      attachmentList?: string(name='AttachmentList'),
      attachmented?: boolean(name='Attachmented'),
      blackListNotice?: string(name='BlackListNotice'),
      changeLogList?: string(name='ChangeLogList'),
      closedDuration?: int32(name='ClosedDuration'),
      commentList?: string(name='CommentList'),
      commitDate?: long(name='CommitDate'),
      createdAt?: long(name='CreatedAt'),
      devDuration?: int32(name='DevDuration'),
      fixedDuration?: int32(name='FixedDuration'),
      fixedUserId?: int32(name='FixedUserId'),
      id?: int32(name='Id'),
      idPath?: string(name='IdPath'),
      ignoreCheck?: boolean(name='IgnoreCheck'),
      ignoreIntegrate?: boolean(name='IgnoreIntegrate'),
      issueRelations?: string(name='IssueRelations'),
      issueTypeId?: int32(name='IssueTypeId'),
      linePath?: string(name='LinePath'),
      logicalStatus?: string(name='LogicalStatus'),
      moduleIds?: string(name='ModuleIds'),
      moduleList?: string(name='ModuleList'),
      moduleUpdated?: boolean(name='ModuleUpdated'),
      parentId?: int32(name='ParentId'),
      priority?: string(name='Priority'),
      priorityId?: int32(name='PriorityId'),
      projectId?: int32(name='ProjectId'),
      projectIds?: string(name='ProjectIds'),
      recordChangeLog?: boolean(name='RecordChangeLog'),
      region?: string(name='Region'),
      relatedAKProjectGuids?: string(name='RelatedAKProjectGuids'),
      relatedAKProjectIds?: string(name='RelatedAKProjectIds'),
      relatedUserIds?: string(name='RelatedUserIds'),
      respondDuration?: int32(name='RespondDuration'),
      scope?: int32(name='Scope'),
      scopeUserIds?: string(name='ScopeUserIds'),
      sendWangwang?: boolean(name='SendWangwang'),
      seriousLevel?: string(name='SeriousLevel'),
      seriousLevelId?: int32(name='SeriousLevelId'),
      skipCollab?: boolean(name='SkipCollab'),
      solution?: int32(name='Solution'),
      source?: string(name='Source'),
      sourceId?: int32(name='SourceId'),
      sprintId?: int32(name='SprintId'),
      stamp?: string(name='Stamp'),
      status?: string(name='Status'),
      statusId?: int32(name='StatusId'),
      statusStage?: int32(name='StatusStage'),
      subject?: string(name='Subject'),
      tagIdList?: string(name='TagIdList'),
      templateId?: int32(name='TemplateId'),
      testsuiteId?: int32(name='TestsuiteId'),
      trackerIds?: string(name='TrackerIds'),
      trackers?: string(name='Trackers'),
      updatedAt?: long(name='UpdatedAt'),
      user?: string(name='User'),
      userId?: int32(name='UserId'),
      userStaffId?: string(name='UserStaffId'),
      verifier?: string(name='Verifier'),
      verifierId?: int32(name='VerifierId'),
      verifierStaffId?: string(name='VerifierStaffId'),
      versionId?: int32(name='VersionId'),
      versionIds?: string(name='VersionIds'),
      versionList?: string(name='VersionList'),
      watched?: boolean(name='Watched'),
      watcherIdList?: string(name='WatcherIdList'),
    }
  ](name='Data'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  toPage?: int32(name='ToPage'),
  totalCount?: int32(name='TotalCount'),
  totalPages?: int32(name='TotalPages'),
}

model SearchWorkitemWithTotalCountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchWorkitemWithTotalCountResponseBody(name='body'),
}

async function searchWorkitemWithTotalCountWithOptions(request: SearchWorkitemWithTotalCountRequest, runtime: Util.RuntimeOptions): SearchWorkitemWithTotalCountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.AKProjectId)) {
    body['AKProjectId'] = request.AKProjectId;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sprintId)) {
    body['SprintId'] = request.sprintId;
  }
  if (!Util.isUnset(request.stamp)) {
    body['Stamp'] = request.stamp;
  }
  if (!Util.isUnset(request.toPage)) {
    body['ToPage'] = request.toPage;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SearchWorkitemWithTotalCount',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchWorkitemWithTotalCount(request: SearchWorkitemWithTotalCountRequest): SearchWorkitemWithTotalCountResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchWorkitemWithTotalCountWithOptions(request, runtime);
}

model SyncUserToRdcRequest {
  loginTicket?: string(name='LoginTicket'),
}

model SyncUserToRdcResponseBody = {
  code?: int32(name='Code'),
  data?: {
    isValid?: boolean(name='IsValid'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SyncUserToRdcResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SyncUserToRdcResponseBody(name='body'),
}

async function syncUserToRdcWithOptions(request: SyncUserToRdcRequest, runtime: Util.RuntimeOptions): SyncUserToRdcResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.loginTicket)) {
    body['LoginTicket'] = request.loginTicket;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SyncUserToRdc',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function syncUserToRdc(request: SyncUserToRdcRequest): SyncUserToRdcResponse {
  var runtime = new Util.RuntimeOptions{};
  return syncUserToRdcWithOptions(request, runtime);
}

model UpdateWorkitemRequest {
  AKProjectId?: int32(name='AKProjectId'),
  assignedTo?: string(name='AssignedTo'),
  cfList?: map[string]any(name='CfList'),
  cfs?: map[string]any(name='Cfs'),
  corpIdentifier?: string(name='CorpIdentifier'),
  description?: string(name='Description'),
  ignoreCheck?: boolean(name='IgnoreCheck'),
  issueId?: int32(name='IssueId'),
  modifier?: string(name='Modifier'),
  priority?: string(name='Priority'),
  seriousLevel?: string(name='SeriousLevel'),
  sprintId?: int32(name='SprintId'),
  stamp?: string(name='Stamp'),
  status?: string(name='Status'),
  subject?: string(name='Subject'),
  templateId?: int32(name='TemplateId'),
  verifier?: string(name='Verifier'),
}

model UpdateWorkitemShrinkRequest {
  AKProjectId?: int32(name='AKProjectId'),
  assignedTo?: string(name='AssignedTo'),
  cfListShrink?: string(name='CfList'),
  cfsShrink?: string(name='Cfs'),
  corpIdentifier?: string(name='CorpIdentifier'),
  description?: string(name='Description'),
  ignoreCheck?: boolean(name='IgnoreCheck'),
  issueId?: int32(name='IssueId'),
  modifier?: string(name='Modifier'),
  priority?: string(name='Priority'),
  seriousLevel?: string(name='SeriousLevel'),
  sprintId?: int32(name='SprintId'),
  stamp?: string(name='Stamp'),
  status?: string(name='Status'),
  subject?: string(name='Subject'),
  templateId?: int32(name='TemplateId'),
  verifier?: string(name='Verifier'),
}

model UpdateWorkitemResponseBody = {
  code?: int32(name='Code'),
  data?: boolean(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateWorkitemResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateWorkitemResponseBody(name='body'),
}

async function updateWorkitemWithOptions(tmpReq: UpdateWorkitemRequest, runtime: Util.RuntimeOptions): UpdateWorkitemResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateWorkitemShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.cfList)) {
    request.cfListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.cfList, 'CfList', 'json');
  }
  if (!Util.isUnset(tmpReq.cfs)) {
    request.cfsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.cfs, 'Cfs', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.corpIdentifier)) {
    query['CorpIdentifier'] = request.corpIdentifier;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.AKProjectId)) {
    body['AKProjectId'] = request.AKProjectId;
  }
  if (!Util.isUnset(request.assignedTo)) {
    body['AssignedTo'] = request.assignedTo;
  }
  if (!Util.isUnset(request.cfListShrink)) {
    body['CfList'] = request.cfListShrink;
  }
  if (!Util.isUnset(request.cfsShrink)) {
    body['Cfs'] = request.cfsShrink;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.ignoreCheck)) {
    body['IgnoreCheck'] = request.ignoreCheck;
  }
  if (!Util.isUnset(request.issueId)) {
    body['IssueId'] = request.issueId;
  }
  if (!Util.isUnset(request.modifier)) {
    body['Modifier'] = request.modifier;
  }
  if (!Util.isUnset(request.priority)) {
    body['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.seriousLevel)) {
    body['SeriousLevel'] = request.seriousLevel;
  }
  if (!Util.isUnset(request.sprintId)) {
    body['SprintId'] = request.sprintId;
  }
  if (!Util.isUnset(request.stamp)) {
    body['Stamp'] = request.stamp;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.subject)) {
    body['Subject'] = request.subject;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.verifier)) {
    body['Verifier'] = request.verifier;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateWorkitem',
    version = '2018-08-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateWorkitem(request: UpdateWorkitemRequest): UpdateWorkitemResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateWorkitemWithOptions(request, runtime);
}

